import Image,ImageDraw, ImageEnhance


if __name__ == '__main__':
    image_name = "training.tif"
    im = Image.open(image_name)
    x_size, y_size = im.size;
    pix = im.load()
    ocr_image = im.crop((0, 0, x_size, y_size))
    enhancer = ImageEnhance.Sharpness(ocr_image)
    ocr_image = enhancer.enhance(5)
#    enhancer = ImageEnhance.Contrast(ocr_image)
#    ocr_image = enhancer.enhance(2)
    ocr_image.save('black_' + image_name)